//
// Created by Administrator on 2021/7/28.
//
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    // 模拟随时间增长，内存分配的过程
    vector<int> memLeak(int memory1, int memory2) {
        int time = 1; // 时间
        while (memory1 >= time or memory2 >= time) {
            // 分配给剩余容量较多的内存
            if (memory1 >= memory2)
                memory1 -= time;
            else
                memory2 -= time;
            ++time;
        }
        return {time, memory1, memory2};
    }
};

int main() {
    Solution solution;
    auto ans = solution.memLeak(2, 2);
    for (auto &x:ans) cout << x << endl;
    return 0;
}